myApp.controller('upEmailController', function($scope,$uibModal,$serEmail, toaster,$stateParams,$state) {
    var ctrl = this;
    ctrl.vm = {
        data:{},
        up:function (id) {
            $serEmail.updateIt({
                id:id,
                code:ctrl.vm.data.code,
                name:ctrl.vm.data.name,
                content:ctrl.vm.data.content,
                info:ctrl.vm.data.info,
            }).then(function(res){
                if(res.code==1){
                    toaster.info('提示',res.message);
                    $state.go('app.email.email',{});
                }else{
                    toaster.info('提示',res.message);
                }
            })
        }
    };
    var vm ={
        init:function(){
            $serEmail.getIt({
                id:$stateParams.id
            }).then(function(res){
                if(res.code==1){
                    ctrl.vm.data = res.data;
                }else{
                    toaster.info('提示',res.message);
                }
            })
        }
    };
    vm.init();

});
